<?php
namespace Secret\Controllers;

use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;

class LoginCSP implements ControllerProviderInterface {

	public function connect(Application $app) {
		$controllers = $app['controllers_factory'];
		$controllers->match('/', function (Application $app, Request $request) {
			return $app['twig']->render("login.twig", array('error' => $app['security.last_error']($request),'last_username' => $app['session']->get('_security.last_username')));
		}, 'GET|POST');
		return $controllers;
	}
}